<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title>01入门</title>
	<style type="text/css">
	* {
		padding: 0;
		margin: 0;
	}
    </style>
</head>
<body>
	<div class="container">
		<h1>01入门</h1>
	</div>
	<script src="https://cdn.staticfile.org/jquery/3.2.0/jquery.js"></script>
	<script type="text/javascript">
	var reg = /\b(\w+)\b\s*\b\1\b/g

	// reg = /\b(?<Word>\w+)\b\s*\b\k<Word>\b/g
	reg = /\b(?<Word>\w+)\s*\k<Word>\b/g

	var str = 'Good Morning, hi lilei, hi and  go go, 或者kitty kitty Lucy.'
	// 高版本的浏览器 才支持 str.matchAll 返回  RegExpStringIterator 迭代器
	var matchIter = str.matchAll(reg)
	console.log(matchIter)
	
	for(let item of matchIter) {
		console.log(item)
	}
	
	
	</script>
</body>
</html>